package IC.Parser;

//SyntaxError Class
public class SyntaxError extends Exception 
{
	private static final long serialVersionUID = 1L;
    private int line=-1;
    private Token token = null;
       
   
    //C'tor
    public SyntaxError(String message) {
        super(message);
    }
       
    //C'tor
    public SyntaxError(int line, String message) {
        super(message);
        this.line = line;  
    }
    
    //C'tor
    public SyntaxError(int line, Token token) {         
        this.line = line; 
        this.token  = token;    
    } 
    
    //getMessage
    public String getMessage() {
        if (token == null) 
        	return super.getMessage();
        return line + ": Unrecovered syntax error; unexpected " + token.getName();
    }
}